package zhongbo.java.air.flightpath.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import zhongbo.java.air.flightpath.entity.AirFlightPath;

import static zhongbo.java.air.flightpath.config.RedisListenerConfig.LIVE_FLIGHT_PATH_HYJ;
import static zhongbo.java.air.flightpath.config.RedisListenerConfig.LOG_CHANEL;

@Component
public class RedisLogChanelPublisher {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    // 发送消息到频道
    public void broadcast(String message) {
        redisTemplate.convertAndSend(LIVE_FLIGHT_PATH_HYJ, message);
    }
    public void broadcastJson(AirFlightPath message) {
        redisTemplate.convertAndSend(LIVE_FLIGHT_PATH_HYJ, message);
    }
}
